package com.jketing.entity.ams.sys;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.jketing.entity.BaseEntity;
/**
 * Popedom 权限实体
 * 
 * @author  李荣华
 * @version v1.0
 * @date     2017-08-15
 * @since   JPA 2.1
 */
@Entity
@Table(name="Popedom_")
public class Popedom extends BaseEntity{
	private static final long serialVersionUID = -3864208234024737196L;
	/**
	 * role:角色
	 */
	private Role role;
	/**
	 * function:功能
	 */
	private Function function;
	/**
	 * operation:操作
	 */
	private Operation operation;
	
	/**
     * Role 权限角色
     */
	@ManyToOne
	@JoinColumn(name = "RoleId")
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	
	/**
     * Function 权限功能
     */
	@ManyToOne
	@JoinColumn(name = "FunctionId")
	public Function getFunction() {
		return function;
	}
	public void setFunction(Function function) {
		this.function = function;
	}
	
	/**
     * Button 权限操作
     */
	@ManyToOne
	@JoinColumn(name = "OperationId")
	public Operation getOperation() {
		return operation;
	}
	public void setOperation(Operation operation) {
		this.operation = operation;
	}
   
	/**
	 * 	equals 判断实例是否相等
	 * 
	 * 	是本类实例并且实例id值相等返回true
	 * 	其它情况返回false
	 * 
	 * 	@param object 其它实例
	 */
	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Popedom)) {
			return false;
		}
		Popedom other = (Popedom) object;
		if(id==null||other==null||!id.equals(other.id)){
			return false;
		}
		return true;
	}
}
